package tournament.volleyball;

public class BracketRivalry extends Rivalry {
	
	public BracketRivalry(Team team1, Team team2){
		super(team1, team2);
		
		int gamesPerSet = 2;
		initialize(gamesPerSet);
	}
	
	public BracketRivalry(BracketRivalry upLevel1, BracketRivalry upLevel2){
		super(upLevel1.getWinner(), upLevel2.getWinner());
		
		int gamesPerSet = 2;
		initialize(gamesPerSet);
	}
	
	private Team getWinner() {
		if (getWins(team1) > getWins(team2)) {
			return team1;
		} else if (getWins(team2) > getWins(team1)) {
			return team2;
		} else {
			return null;
		}
	}
	
	public int addTiebreaker() {
		games.add(new Game(this));
		
		return games.size();
	}

}
